﻿using System;

namespace BSharp.Compiler
{

	public enum BinaryOperation {
		Add,
		Sub,
		Div,
		Mod,
		Mul,
		Xor,
		Or,
		And,
		Equal,
		NotEqual,
		GreaterThan,
		LessThan,
		GreaterThanOrEqu,
		LessThanOrEqu,
		LeftBitShift,
		RightBitShift,
		Assign
	}

	public class BinaryExpression : AstNode
	{
		public readonly BinaryOperation Operation;
		public readonly AstNode Left;
		public readonly AstNode Right;

		public BinaryExpression (SourceLocation location, 
			BinaryOperation operation,
			AstNode left,
			AstNode right) : base (location)
		{
			Operation = operation;
			Left = left;
			Right = right;
		}

		public override void Visit (AstVisitor visitor)
		{
			visitor.Accept (this);
		}

		public override void VisitChildren (AstVisitor visitor)
		{
			Left.Visit (visitor);
			Right.VisitChildren (visitor);
		}
	}
}

